@echo off

REM 本BAT支持带参数运行，例如pythonsetup d:\python则将conda环境安装到d:\python目录下
REM 若无参数时，默认安装到C:\CONDA目录下

REM 本BAT文件原始编码为UTF-8编码，如果您将内容保存到一个ANSI编码的新BAT文件中，请删除以下的chcp语句避免乱码
chcp 65001 > NUL

REG QUERY "HKU\S-1-5-19">NUL 2>&1&& goto :UAC
echo 需要系统管理员权限进行安装软件，请在提示是否允许修改设备时通过申请
pause
(powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&exit)
:UAC
echo 已检测到管理员权限

if [%1]==[] (set CONDAPATH=C:\CONDA) else (set CONDAPATH=%~f1)
echo Python环境将被安装到%CONDAPATH%目录下

REM 安装WinGet-CLI
winget >NUL 2>&1 && goto :WinGetDetect
echo 未检测到WinGet, 开始下载安装WinGet
mkdir c:\temp >NUL 2>&1
powershell -c "invoke-webrequest -uri https://github.com/microsoft/winget-cli/releases/download/v1.4.2161-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -outfile C:\temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
C:\temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
echo WinGet安装中，请在根据弹窗提示完成安装操作后继续
pause
del C:\temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle >NUL
goto :DoneWinGet
:WinGetDetect
echo 检测到WinGet
:DoneWinGet

REM WinGet环境准备就绪，在此行之后添加其他的软件安装命令定制环境安装批命令
winget install Git.Git
REM install : https://download.jetbrains.com.cn/python/pycharm-edu-2022.2.2.exe
winget install Anaconda.Miniconda3 --location "%CONDAPATH%"
powershell -Command "Set-ExecutionPolicy RemoteSigned -Force"
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
%CONDAPATH%\Scripts\conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
%CONDAPATH%\Scripts\conda config --set show_channel_urls yes
%CONDAPATH%\Scripts\conda init --all
cmd /c "conda update --all --yes"
REM install : https://download.jetbrains.com.cn/python/pycharm-edu-2022.2.2.exe



